<template>
  <div>
    <Title :title="'交通效率分析'"/>
    <div class="blockContainer">
      <!-- <div class="btnContainer">
        <div class="btn" v-for="item in tableData" :key="item.id"
          :class="{'activeBtn' : menuId === item.name}" @click="handleClick(item)">
          {{item.name}}
        </div>
      </div> -->
      <div class="tableContainer">
        <div class="text">
          <div class="all">
            <div class="congestionCard congestionCardBack">
                <!-- <div class="point pointheader"><i>#</i></div> -->
                <span>车道名称</span>
                <span>流量</span>
                <span>运行指数</span>
                <span>平均延误时间</span>
                <span>平均停车次数</span>
                <!-- <span>终点</span> -->
                <!-- <div class="progressClass"></div>
                <b>指数</b> -->
            </div>
            <div v-for="(item, index) in junctionCongestion" :key="index" class="congestionCard">
                <!-- <div class="point"><i></i></div> -->
                <span>{{ item.roadName }}</span>
                <span>{{ item.flow }}</span>
                <span>{{ item.index }}</span>
                <span>{{ item.avgDelay }}</span>
                <span>{{ item.avgStops }}</span>
                <!-- <el-progress :percentage="item.num / 10 * 100" color="rgba(84, 181, 255, 0.6)" :show-text="false" class="progressClass"></el-progress> -->
                <!-- <b>{{item.num}}</b> -->
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, reactive, toRefs, computed, onMounted } from 'vue';
import EcResize from '@sutpc/vue3-ec-resize';
import Title from '../title.vue'
// import { xiaoche } from '@/assets/images/imagesIn'

import { getRoadIndex } from '../../../../utils/apiComponent'
export default defineComponent({
  name: 'ComponentOne',
  components: {
    Title,
    EcResize
  },
  setup() {
    const data = reactive({
      junctionCongestion: [
        {
          "    ": "坪山大道 南向进口",
          "flow": 0,
          "index": 0,
          "avgDelay": 0,
          "avgStops": 0
        },{
          "roadName": "坪山大道 南向进口",
          "flow": 0,
          "index": 0,
          "avgDelay": 0,
          "avgStops": 0
        },{
          "roadName": "坪山大道 南向进口",
          "flow": 0,
          "index": 0,
          "avgDelay": 0,
          "avgStops": 0
        },{
          "roadName": "坪山大道 南向进口",
          "flow": 0,
          "index": 0,
          "avgDelay": 0,
          "avgStops": 0
        },{
          "roadName": "坪山大道 南向进口",
          "flow": 0,
          "index": 0,
          "avgDelay": 0,
          "avgStops": 0
        },{
          "roadName": "坪山大道 南向进口",
          "flow": 0,
          "index": 0,
          "avgDelay": 0,
          "avgStops": 0
        },{
          "roadName": "坪山大道 南向进口",
          "flow": 0,
          "index": 0,
          "avgDelay": 0,
          "avgStops": 0
        },
      ]
    })
    const initData = () => {
      getRoadIndex().then((res) => {
        // console.log(res)
        data.junctionCongestion = res.splice(0,7)
      })
    }
    onMounted(() => {
      initData()
    })
    const refData = toRefs(data)
    return {
      ...refData
    }
  }
})
</script>

<style lang="less" scoped>
@import '../../common.less';
.box{
  width: 100%;
  height: 84px;;
  background-image: url('@{publicPath}static/images/componenttwo/img_moren.png');
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.ec-wrap {
  width: 100%;
  height: 200px;
  margin-bottom: 30px;
}
.tableContainer{
  margin: 18px auto;
  width: 100%;
  .text{
    width: 100%;
  }
}
.blockContainer{
  width: 100%;

}
.all{
  // padding: 0 30px;
  /* background-color: rgba(0,0,0,.5); */
  /* border: 1px solid rgba(255,255,255, .15); */
  width: 100%;
  border-radius: 2px;;
  margin: 10px 0;
  margin-bottom: 10px;
}
.congestionCard{
  font-size: 14px;
}
.congestionCard.congestionCardBack{
  background: linear-gradient(0 , #1C3B68 0%, rgba(47,61,82,0.09) 100%) !important;
  height: 40px;;
}
.congestionCard:nth-child(odd){
  background: rgba(14,39,88,0.35);
}
.congestionCard{
  width: 100%;
  height: 56px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 0 0 20px 0;
  padding: 0 20px;;
  span{
    width: 18%;
    white-space: nowrap;
    overflow: hidden;
  }
  b{
    width: 10%;
    text-align: right
    ;
  }
  .point{
    width: 10%;
    height: 100%;;
    display: flex;justify-content: center;
    align-items: center;
    i{
      display: block;;
      width: 20px;
      height:20px;
      background-image: url('@{publicPath}static/images/global/four.png');
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }
  }
  .pointheader i{
    background: rgba(36, 87, 139, 1);
    border-radius: 50%;
    text-align: center;
    line-height: 20px;;
  }
  .progressClass{
    width: 40%
  }
}
.congestionCard strong{
  display: block;
  width: 95%;
height: 21px;
background: linear-gradient( -90deg, #54B5FF 0%, rgba(84,181,255,0) 100%);
}
.btnContainer{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 16px;
  width: 100%;
  // margin: 0 auto;
  margin-top: 10px;
}

</style>